var appRegister = angular.module('app-register', []);

appRegister.controller('ctl-register', function($scope, $http) {
	$scope.registerSubmit = function() {
		$http({
		    method : 'POST',
		    url : "../user",
		    data : $scope.user,
		    headers : {
		        "Content-Type" : "application/json",
		        "charset" : "utf-8"
		    }
		}).then(function successCallback(response) {
			if (response.data == "success") {
				window.location.href = "success.html";
			} else {
				bootbox.alert(response.data);
			}
		}, function errorCallback(response) {
		});
	};

});